<template>
  <div class="checkin_info_summary">
    <table style="table-layout: fixed;width: 100%;border-collapse: collapse;">
      <thead>
        <tr>
          <th><div>入离时间</div></th>
          <th>房价</th>
          <th>押金</th>
          <th>收费</th>
          <th>消费</th>
          <th>预授权</th>
          <th>备注</th>
          <th style="width: 100px;">余额</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>
            <div>
              <span class="in_block">{{ info.peopleEntity.newArrivalsTime }}</span>
              -
              <span class="in_block">{{ info.peopleEntity.newPredissociationTime }}</span>
            </div>
          </td>
          <td>
            <div>￥ {{ priceMap[today] ? priceMap[today] : currData }}</div>
          </td>
          <td class="cursor">
            <div>￥ {{ info.peopleEntity.deposit }}</div>
          </td>
          <td class="cursor">
            <div>￥ {{ info.peopleEntity.payment }}</div>
          </td>
          <td class="cursor">
            <div>￥ {{ info.peopleEntity.consumption }}</div>
          </td>
          <td>
            <div class="blue_color1 cursor" @click="yushouqlistComBtn" style="cursor: pointer;">￥ {{ info.peopleEntity.xinyongCardMoney }}</div>
          </td>
          <td class="cursor">
            <div class="remark_ellipsis" style="padding: 0px 20px;">{{ info.singleEntity.remarks ? info.singleEntity.remarks : '无' }}</div>
          </td>
          <td>
            <div>￥ {{ info.peopleEntity.payment - info.peopleEntity.consumption }}</div>
          </td>
        </tr>
      </tbody>
    </table>

    <el-divider style="margin: 20px 0;margin-bottom: 0;"></el-divider>

    <!-- 按钮组 -->
    <div style="height: 60px;line-height: 60px;">
      <div style="float: left;">
        <el-button @click="ruzhangHandle(info.peopleEntity)" v-if="info.peopleEntity.state == 1 || info.peopleEntity.state == 2">入账</el-button>
        <el-button @click="jieZhangTuiFang(info.peopleEntity)" v-if="info.peopleEntity.state == 1 || info.peopleEntity.state == 2">结账退房</el-button>
        <el-button @click="notJieEtixBtn(info.floorRoomEntity)" v-if="info.peopleEntity.state == 1">未结退房</el-button>
        <el-button v-if="info.peopleEntity.state == 1" @click="xuzhuTiqian(info.peopleEntity)">续住/提前</el-button>
        <el-button v-if="info.peopleEntity.state == 1" @click="addPeopleBtn(info.peopleEntity)">添加同住</el-button>
        <el-button v-if="info.peopleEntity.state == 1 || info.peopleEntity.state == 2" @click="joinRoomBtn(info.peopleEntity.singleId)">联房</el-button>
        <el-button v-if="info.peopleEntity.state == 1 && info.floorRoomEntity.singleNo != 0" @click="etixRoom(info.peopleEntity.floorRoomId)">退出联房</el-button>
        <el-button @click="chexiao(info.peopleEntity)" v-if="info.peopleEntity.state == 0">撤销结账</el-button>
        <el-button @click="chexiaoNotJieZhang(info.peopleEntity.id)" v-if="info.peopleEntity.state == 2">撤销结账</el-button>
      </div>
      <div style="float: right;">
        <el-tooltip class="item" effect="dark" content="已开票金额：￥100" placement="bottom"><el-button @click="invoiceShow()">发票</el-button></el-tooltip>
        <el-button @click="printPreview()">打印</el-button>
        <!-- <el-button>锁定订单</el-button> -->
      </div>
    </div>

    <ruzhang v-if="ruzhangVisible" ref="ruzhang" @refreshDataList="getInfo()"></ruzhang>
    <closingRoom v-if="closingRoomVisible" ref="closingRoom" @refreClosing="unRoom" @refrePrintJieZhang="printJieZhang" @refreshDataList="getInfo()"></closingRoom>
    <addPeople v-if="addPeopleVisible" ref="addPeople" @refreClosing="unRoom" @refreshDataList="getInfo()"></addPeople>
    <xuzhuTiqian v-if="xuzhuTiqianVisible" ref="xuzhuTiqian" @refreClosing="unRoom" @refreshDataList="getInfo()"></xuzhuTiqian>
    <joinRoom v-if="joinRoomVisible" ref="joinRoom" @refreClosing="unRoom" @refreshDataList="getInfo()"></joinRoom>
    <t1 v-show="false" id="t1" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData" :finance-data="this.financeData"></t1>
    <t2 v-show="false" id="t2" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData" :finance-data="this.financeData"></t2>
    <t3 v-show="false" id="t3" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData" :finance-data="this.financeData"></t3>
    <t4 v-show="false" id="t4" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData" :finance-data="this.financeData" ref="t4"></t4>
    <t5 v-show="false" id="t5" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData" :finance-data="this.financeData" ref="t5"></t5>
    <t6 v-show="false" id="t6" :note="this.printconfig.note" :info="this.info" :priceMap="this.priceMap" :currData="this.currData" :finance-data="this.financeData" ref="t6"></t6>

    <invoice v-if="invoiceVisable" ref="invoice" :info="this.info"></invoice>
  </div>
</template>

<script>
import moment from 'moment';
import ruzhang from './ruzhang';
import closingRoom from './closingRoom';
import joinRoom from './joinRoom';
import addPeople from './addPeople';
import xuzhuTiqian from './xuzhuTiqian';
import t1 from '../../../common/printtemplate/dengji_58mm';
import t2 from '../../../common/printtemplate/dengji_80mm';
import t3 from '../../../common/printtemplate/dengji_A5';
import t4 from '../../../common/printtemplate/jiezhang_58mm';
import t5 from '../../../common/printtemplate/jiezhang_80mm';
import t6 from '../../../common/printtemplate/jiezhang_A5';
import { getLodop } from '../../../../utils/lodop';
import invoice from './invoice';
export default {
  props: ['type', 'financeData', 'peopleId', 'currState'],

  data() {
    return {
      currData: '',
      ruzhangVisible: false,
      joinRoomVisible: false,
      closingRoomVisible: false,
      addPeopleVisible: false,
      xuzhuTiqianVisible: false,
      popInfo: {},
      today: moment().format('YYYY-MM-DD'),
      priceMap: {},
      priceDateList: [],
      info: {
        peopleEntity: {},
        singleEntity: {},
        floorRoomEntity: {},
        roomEntity: {}
      },
      printconfig: {}, //打印配置
      invoiceVisable: false
    };
  },
  components: { ruzhang, closingRoom, addPeople, xuzhuTiqian, joinRoom, t1, t2, t3, t4, t5, t6, invoice },
  methods: {
    print(printFlag) {
      console.log(printFlag);
      if (printFlag == 1) {
        console.log('打印执行方法');
        setTimeout(() => {
          this.$nextTick(() => {
            this.printPreview();
          });
        }, 500);
      }
    },
    printJieZhang(printFlag, singleId) {
      console.log(printFlag);
      if (printFlag == 1) {
        //查询结账订单金额
        console.log('请求账单');
        console.log(singleId);
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/single_jiezhang_water/${singleId}`),
          method: 'get',
          params: this.$http.adornParams()
        }).then(({ data }) => {
          if (data && data.code === 0) {
            console.log(data.data);
            this.$refs.t4.initFinanceData(data.data);
            this.$refs.t5.initFinanceData(data.data);
            this.$refs.t6.initFinanceData(data.data);
            setTimeout(() => {
              this.$nextTick(() => {
                this.printPreview2();
              });
            }, 500);
          } else {
            this.$message.error(data.msg);
          }
        });
      }
    },
    toAccounting(item, type) {
      //将数据存储到本地
      var p = {
        singleId: item.singleId,
        type: type
      };
      this.$cookie.set('accounting', JSON.stringify(p));
    },
    yushouqlistComBtn() {
      console.log(1);
      this.$emit('refreYuShouListFinanceBtn');
    },
    etixRoom(floorRoomId) {
      this.$confirm('您确认要退出联房吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/exit_single/${floorRoomId}`),
          method: 'get',
          params: this.$http.adornParams()
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.toAccounting({ singleId: data.data.id }, '1');
            this.$nextTick(() => {
              this.$emit('refreClosing');
              this.$emit('refreshDataList');
              this.init(this.popInfo);
            });
            this.$message({
              message: this.$t('Common.OperationSuccessful'),
              type: 'success',
              duration: 1500,
              onClose: () => {}
            });
          } else {
            this.$message.error(data.msg);
          }
        });
      });
    },
    notJieEtixBtn(item) {
      console.log(item);
      //主房并且关联的有房间
      if (item.singleMain == 1 && item.singleNo != 0) {
        this.$alert('有联房还未结账，主房不可未结退房', {
          confirmButtonText: '确定'
        });
      } else if (item.singleMain == 0 && item.singleNo != 0) {
        this.$confirm('此房间是联房，未结离店会取消与其他房间的联房，是否继续操作？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/not_jie_etix/${item.id}`),
            method: 'get',
            params: this.$http.adornParams({
              type: 1
            })
          }).then(({ data }) => {
            if (data && data.code === 0) {
              this.$nextTick(() => {
                this.$emit('refreClosing');
                this.$emit('refreshDataList');
                this.init(this.popInfo);
              });
              this.$message({
                message: this.$t('Common.OperationSuccessful'),
                type: 'success',
                duration: 1500,
                onClose: () => {}
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        });
      } else {
        this.$confirm('您确认要未结退房吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$http({
            url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/not_jie_etix/${item.id}`),
            method: 'get',
            params: this.$http.adornParams({
              type: 2
            })
          }).then(({ data }) => {
            if (data && data.code === 0) {
              this.$nextTick(() => {
                this.$emit('refreClosing');
                this.$emit('refreshDataList');
                this.init(this.popInfo);
              });
              this.$message({
                message: this.$t('Common.OperationSuccessful'),
                type: 'success',
                duration: 1500,
                onClose: () => {}
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        });
      }
    },
    chexiao(pop) {
      console.log(pop);
      this.$confirm('您确认要撤销结账吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$prompt('原因', '撤销未结退房', {
          confirmButtonText: '恢复房态',
          cancelButtonText: '不恢复房态',
          inputErrorMessage: '原因不能为空'
        })
          .then(({ value }) => {
            console.log(value);
            this.$http({
              url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/chexiao_jiezhang/${pop.id}`),
              method: 'get',
              params: this.$http.adornParams({
                type: 1
              })
            }).then(({ data }) => {
              if (data && data.code === 0) {
                this.$nextTick(() => {
                  this.$emit('refreClosing');
                  this.$emit('refreshDataList');
                  this.init(this.popInfo);
                });
                this.$message({
                  message: this.$t('Common.OperationSuccessful'),
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                });
              } else {
                this.$message.error(data.msg);
              }
            });
          })
          .catch(({ value }) => {
            console.log(value);
            this.$http({
              url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/chexiao_jiezhang/${pop.id}`),
              method: 'get',
              params: this.$http.adornParams({
                type: 2
              })
            }).then(({ data }) => {
              if (data && data.code === 0) {
                this.$nextTick(() => {
                  this.$emit('refreClosing');
                  this.$emit('refreshDataList');
                  this.init(this.popInfo);
                });
                this.$message({
                  message: this.$t('Common.OperationSuccessful'),
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                });
              } else {
                this.$message.error(data.msg);
              }
            });
          });
      });
    },
    chexiaoNotJieZhang(id) {
      console.log(id);
      this.$confirm('您确认要撤销未结退房吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$prompt('原因', '撤销未结退房', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          inputErrorMessage: '原因不能为空'
        }).then(({ value }) => {
          this.$http({
            url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinaccounting/chexiao_not_jiezhang/${id}`),
            method: 'get',
            params: this.$http.adornParams()
          }).then(({ data }) => {
            if (data && data.code === 0) {
              this.$nextTick(() => {
                this.$emit('refreClosing');
                this.$emit('refreshDataList');
                this.init(this.popInfo);
              });
              this.$message({
                message: this.$t('Common.OperationSuccessful'),
                type: 'success',
                duration: 1500,
                onClose: () => {}
              });
            } else {
              this.$message.error(data.msg);
            }
          });
        });
      });
    },
    unRoom() {
      this.$emit('refreClosing');
    },
    jieZhangTuiFang(item) {
      this.closingRoomVisible = true;
      this.$nextTick(() => {
        this.$refs.closingRoom.init(item);
      });
    },
    // 入账
    ruzhangHandle(item) {
      this.ruzhangVisible = true;
      this.$nextTick(() => {
        this.$refs.ruzhang.init(item);
      });
    },
    // 加入联房
    joinRoomBtn(singleId) {
      this.joinRoomVisible = true;
      this.$nextTick(() => {
        this.$refs.joinRoom.init(singleId);
      });
    },
    init(pop) {
      this.popInfo = pop;
      this.getInfo();
      this.getPrintMsg();
      this.$nextTick(() => {});
    },
    xuzhuTiqian(item) {
      this.xuzhuTiqianVisible = true;
      this.$nextTick(() => {
        this.$refs.xuzhuTiqian.init({ ...item, roomId: this.info.roomEntity.id });
      });
    },
    getInfo() {
      this.$http({
        url: this.$http.adornUrl(`/hotel/thotelfloorroomcheckinsingle/pop_single/${this.popInfo.id}`),
        method: 'get',
        params: this.$http.adornParams()
      }).then(({ data }) => {
        if (data && data.code === 0) {
          this.info.peopleEntity = data.data.peopleEntity;
          this.priceMap = data.data.priceMap;
          this.priceDateList = data.data.priceDateList;
          this.info.singleEntity = data.data.singleEntity;
          this.info.floorRoomEntity = data.data.floorRoomEntity;
          this.info.roomEntity = data.data.roomEntity;
          this.currData = this.priceMap[moment(this.info.peopleEntity.arrivalsTime).format('YYYY-MM-DD')];
          this.info.peopleEntity = {
            ...this.info.peopleEntity,
            newArrivalsTime: moment(this.info.peopleEntity.arrivalsTime).format('MM/DD HH:mm'),
            newPredissociationTime: moment(this.info.peopleEntity.predissociationTime).format('MM/DD HH:mm')
          };
          console.log(this.info.peopleEntity);
        }
      });
    },
    addPeopleBtn(item) {
      this.addPeopleVisible = true;
      this.$nextTick(() => {
        this.$refs.addPeople.init(item);
      });
    },
    getPrintMsg() {
      var url = '';
      if (this.type == '1') {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelprinttemplate/info/1`),
          method: 'get'
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.printconfig = data.tHotelPrintTemplate;
          }
        });
      }
      if (this.type == '2') {
        this.$http({
          url: this.$http.adornUrl(`/hotel/thotelprinttemplate/info/2`),
          method: 'get'
        }).then(({ data }) => {
          if (data && data.code === 0) {
            this.printconfig = data.tHotelPrintTemplate;
          }
        });
      }
    },
    printPreview() {
      this.CreateOneFormPage();
      // if (s == 0) {
      //   LODOP.PRINT() //直接打印
      // }
      // if (s == 1) {
      //   LODOP.PREVIEW() //打印预览
      // }
      // if (s == 2) {
      //   LODOP.PRINT_SETUP() //打印维护
      // }
      // if (s == 3) {
      //   LODOP.PRINT_DESIGN() //打印设计
      // }
      this.$nextTick(() => {
        LODOP.SET_PRINT_COPIES(this.printconfig.printSum);
        console.log(LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint));
        if (this.printconfig.preview) {
          if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
            LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
            // LODOP.PRINT();
            LODOP.PRINT_DESIGN();
          } else {
            LODOP.SET_PRINTER_INDEXA(0);
            // LODOP.PRINT();
            LODOP.PRINT_DESIGN();
          }
        } else {
          if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
            LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
            LODOP.PREVIEW();
            // LODOP.PRINT_DESIGN();
          } else {
            LODOP.SET_PRINTER_INDEXA(0);
            LODOP.PREVIEW();
            // LODOP.PRINT_DESIGN();
          }
        }
      });

    },
    printPreview2() {
      this.CreateOneFormPage2();
      // if (s == 0) {
      //   LODOP.PRINT() //直接打印
      // }
      // if (s == 1) {
      //   LODOP.PREVIEW() //打印预览
      // }
      // if (s == 2) {
      //   LODOP.PRINT_SETUP() //打印维护
      // }
      // if (s == 3) {
      //   LODOP.PRINT_DESIGN() //打印设计
      // }
      this.$nextTick(() => {
        LODOP.SET_PRINT_COPIES(this.printconfig.printSum);
        console.log(LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint));
        if (this.printconfig.preview) {
          if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
            LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
            LODOP.PRINT();
            // LODOP.PRINT_DESIGN();
          } else {
            LODOP.SET_PRINTER_INDEXA(0);
            LODOP.PRINT();
            // LODOP.PRINT_DESIGN();
          }
        } else {
          if (LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint)) {
            LODOP.SET_PRINTER_INDEXA(this.printconfig.defaultPrint);
            LODOP.PREVIEW();
          } else {
            LODOP.SET_PRINTER_INDEXA(0);
            LODOP.PREVIEW();
            // LODOP.PRINT_DESIGN();
          }
        }
      });
    },
    CreateOneFormPage() {
      LODOP = getLodop();
      if (!LODOP) {
        this.$alert(
          `<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='http://www.lodop.net/download/CLodop_Setup_for_Win32NT_4.088Extend.zip' download target='_self'>执行安装</a>,安装后请刷新页面。</font>`,
          '安装',
          {
            confirmButtonText: '确定',
            dangerouslyUseHTMLString: true
          }
        );
        return;
      }
      //样式
      var strStyleCSS = " <link href='https://ebooking.qlan99.com/css/print.css' type='text/css' rel='stylesheet'> ";

      var olstyle1 = '<!DOCTYPE html><html lang="zh-CN"><head>' + strStyleCSS + '</head>' + ' <style> ' + 'div{border:0!important}' + '</style>';
      var body = '';
      this.$refs.t4.initFinanceData(this.financeData);
      this.$refs.t5.initFinanceData(this.financeData);
      this.$refs.t6.initFinanceData(this.financeData);
      if (this.printconfig.specs === '58mm') {
        var olstyle2 = '<style> .print-wrap-normal{width:' + (58 + parseInt(this.printconfig.printContentOffset)) + 'mm !important}</style>';
        body = olstyle1 + olstyle2 + '<body>' + this.$refs.t4.$refs.t4.innerHTML + '</body>';
        LODOP.SET_PRINT_PAGESIZE(0, 580, 2000, ''); //设定纸张大小
      }
      if (this.printconfig.specs === '80mm') {
        var olstyle2 = '<style> .print-wrap-normal{width:' + (80 + parseInt(this.printconfig.printContentOffset)) + 'mm !important}</style>';
        body = olstyle1 + olstyle2 + '<body>' + this.$refs.t5.$refs.t5.innerHTML + '</body>';
        LODOP.SET_PRINT_PAGESIZE(0, 800, 2000, ''); //设定纸张大小
      }
      if (this.printconfig.specs === 'A5') {
        var olstyle2 = '<style> .print-wrap-normal{width:' + (210 + parseInt(this.printconfig.printContentOffset)) + 'mm !important}</style>';
        body = olstyle1 + olstyle2 + '<body>' + this.$refs.t6.$refs.t6.innerHTML + '</body>';
        LODOP.SET_PRINT_PAGESIZE(0, 2100, 2000, ''); //设定纸张大小
      }
      body += '</html>';
      LODOP.ADD_PRINT_HTM(0, this.printconfig.printPaperOffset, 1000, 2000, body); //增加超文本项
      // LODOP.PRINT_INITA(this.printconfig.printContentOffset, this.printconfig.printPaperOffset) //打印初始化、设定纸张整体偏移量、设定可视编辑区域大小

      LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '100%'); //设置缩放
      // LODOP.PRINT_INIT('订单') //打印初始化
      LODOP.SET_PRINT_STYLE('FontSize', 12); //设置对象风格
      LODOP.SET_PRINT_STYLE('Bold', 1); ////设置对象风格
      LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, ''); //设置窗口
      // LODOP.SET_PRINT_STYLEA(0, "Horient", 2);
      LODOP.SET_PRINT_COPIES(this.printconfig.printSum); //设置打印次数
      // if (LODOP.SET_PRINTER_INDEXA("打印机名"))  //根据打印机名字打印
      //   LODOP.PRINT();
      // 打印二维码
      // LODOP.ADD_PRINT_BARCODE(23,23,233,233,"QRCode","https://blog.csdn.net/qq_43652509");
      //打印网址
      // LODOP.ADD_PRINT_URL(222,2000,2000,233,"https://blog.csdn.net/qq_43652509");
      //打印图片
      // LODOP.ADD_PRINT_IMAGE(100,100,400,400,"<img border='0' src='http://s1.sinaimg.cn/middle/4fe4ba17hb5afe2caa990&690' width='345' height='250'>");
    },
    CreateOneFormPage2() {
      LODOP = getLodop();
      if (!LODOP) {
        this.$alert(
          `<br><font color='#FF00FF'>CLodop云打印服务(localhost本地)未安装启动!点击这里<a href='http://www.lodop.net/download/CLodop_Setup_for_Win32NT_4.088Extend.zip' download target='_self'>执行安装</a>,安装后请刷新页面。</font>`,
          '安装',
          {
            confirmButtonText: '确定',
            dangerouslyUseHTMLString: true
          }
        );
        return;
      }
      //样式
      var strStyleCSS = " <link href='https://ebooking.qlan99.com/css/print.css' type='text/css' rel='stylesheet'> ";

      var olstyle1 = '<!DOCTYPE html><html lang="zh-CN"><head>' + strStyleCSS + '</head>' + ' <style> ' + 'div{border:0!important}' + '</style>';
      var body = '';
      if (this.printconfig.specs === '58mm') {
        var olstyle2 = '<style> .print-wrap-normal{width:' + (58 + parseInt(this.printconfig.printContentOffset)) + 'mm !important}</style>';
        body = olstyle1 + olstyle2 + '<body>' + this.$refs.t4.$refs.t4.innerHTML + '</body>';
        LODOP.SET_PRINT_PAGESIZE(0, 580, 2000, ''); //设定纸张大小
      }
      if (this.printconfig.specs === '80mm') {
        var olstyle2 = '<style> .print-wrap-normal{width:' + (80 + parseInt(this.printconfig.printContentOffset)) + 'mm !important}</style>';
        body = olstyle1 + olstyle2 + '<body>' + this.$refs.t5.$refs.t5.innerHTML + '</body>';
        LODOP.SET_PRINT_PAGESIZE(0, 800, 2000, ''); //设定纸张大小
      }
      if (this.printconfig.specs === 'A5') {
        var olstyle2 = '<style> .print-wrap-normal{width:' + (210 + parseInt(this.printconfig.printContentOffset)) + 'mm !important}</style>';
        body = olstyle1 + olstyle2 + '<body>' + this.$refs.t6.$refs.t6.innerHTML + '</body>';
        LODOP.SET_PRINT_PAGESIZE(0, 2100, 2000, ''); //设定纸张大小
      }
      body += '</html>';
      LODOP.ADD_PRINT_HTM(0, this.printconfig.printPaperOffset, 1000, 2000, body); //增加超文本项
      // LODOP.PRINT_INITA(this.printconfig.printContentOffset, this.printconfig.printPaperOffset) //打印初始化、设定纸张整体偏移量、设定可视编辑区域大小
      LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', '95%'); //设置缩放
      // LODOP.PRINT_INIT('订单') //打印初始化
      LODOP.SET_PRINT_STYLE('FontSize', 12); //设置对象风格
      LODOP.SET_PRINT_STYLE('Bold', 1); ////设置对象风格
      LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, ''); //设置窗口
      // LODOP.SET_PRINT_STYLEA(0, "Horient", 2);
      LODOP.SET_PRINT_COPIES(this.printconfig.printSum); //设置打印次数
      // if (LODOP.SET_PRINTER_INDEXA("打印机名"))  //根据打印机名字打印
      //   LODOP.PRINT();
      // 打印二维码
      // LODOP.ADD_PRINT_BARCODE(23,23,233,233,"QRCode","https://blog.csdn.net/qq_43652509");
      //打印网址
      // LODOP.ADD_PRINT_URL(222,2000,2000,233,"https://blog.csdn.net/qq_43652509");
      //打印图片
      // LODOP.ADD_PRINT_IMAGE(100,100,400,400,"<img border='0' src='http://s1.sinaimg.cn/middle/4fe4ba17hb5afe2caa990&690' width='345' height='250'>");
    },
    invoiceShow() {
      this.invoiceVisable = true;
      this.$nextTick(() => {
        this.$refs.invoice.init();
      });
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.$emit('setPrintData', this.info, this.currData, this.priceMap);
    });
    const s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://localhost:8000/CLodopFuncs.js';
    document.body.appendChild(s);
  }
};
</script>

<style>
.checkin_info_summary th {
  padding-top: 15px;
  color: #666;
  text-align: center;
}
/* .checkin_info_summary tr th:last-of-type {
  border-top-right-radius: 4px;
  border-top-left-radius: 4px;
  background: #f24e4c;
  color: #fff;
}
.checkin_info_summary tr td:last-of-type {
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 4px;
  background: #f24e4c;
  color: #fff;
} */
.checkin_info_summary td {
  height: 48px;
  color: #151515;
  text-align: center;
}
</style>
